#pragma once

#include <initguid.h>
#include <winioctl.h>

DEFINE_GUID(GUID_DEVINTERFACE_INDIRECT_DEVICE,
	0x6b06164c, 0x8a07, 0x4820, 0x91, 0x39, 0x19, 0x75, 0x8f, 0x29, 0xe4, 0x3e);

// {4d36e968-e325-11ce-bfc1-08002be10318}
// This is a system-preserved device class GUID for display adapters
DEFINE_GUID(GUID_DEV_CLASS_DISPLAY_ADAPTER,
	0x4d36e968, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18);

// GUID for Indirect Display Device
// {6C2DAA24-08C9-4BDF-8791-68DA023EDA11}
DEFINE_GUID(GUID_DEV_INDIRECT_DISP,
	0x6c2daa24, 0x8c9, 0x4bdf, 0x87, 0x91, 0x68, 0xda, 0x2, 0x3e, 0xda, 0x11);

DEFINE_GUID(GUID_DEV_INDIRECT_USB,
	0x36fc9e60, 0xc465, 0x11cf, 0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);


#define INDIRECT_DISP_IOCTL_USER_RW(_index_) \
    CTL_CODE (FILE_DEVICE_BUS_EXTENDER, _index_, METHOD_BUFFERED, \
              FILE_ANY_ACCESS | FILE_READ_DATA | FILE_WRITE_DATA)

#define INDIRECT_DISP_IOCTL_USER_RO(_index_) \
    CTL_CODE (FILE_DEVICE_BUS_EXTENDER, _index_, METHOD_BUFFERED, \
              FILE_ANY_ACCESS | FILE_READ_DATA)

#define INDIRECT_DISP_IOCTL_USER_WO(_index_) \
    CTL_CODE (FILE_DEVICE_BUS_EXTENDER, _index_, METHOD_BUFFERED, \
              FILE_ANY_ACCESS | FILE_WRITE_DATA)

#define IOCTL_MONITOR_ARRIVE INDIRECT_DISP_IOCTL_USER_RO(0x0)

#define IOCTL_MONITOR_DEPART INDIRECT_DISP_IOCTL_USER_WO(0x1)

#define IOCTL_ADAPTER_ECHO   INDIRECT_DISP_IOCTL_USER_RW(0x2)

//#define IOCTL_MONITOR_ARRIVE   CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
//#define IOCTL_MONITOR_DEPART   CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
//#define IOCTL_ADAPTER_ECHO	   CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)


typedef struct {
	DWORD dwMonitorIndex;
} MONITOR_ARRIVE_ARG_OUT, *PMONITOR_ARRIVE_ARG_OUT;

typedef struct {
	DWORD dwMonitorIndex;
} MONITOR_DEPART_ARG_IN, *PMONITOR_DEPART_ARG_IN;

constexpr size_t MAX_MONITOR_NUM = 1;
